<?php
    /**
     *  Pdk Search Criteria
     */
    require_once(_DIR_PLUGIN_PDK.'classes/PdkRechercher.php');
    
	function critere_pdkrecherche($idb, &$boucles, $crit) {
	   $boucle = &$boucles[$idb];
       $id_table = $boucle->id_table;
       
       $rechercher = new PdkRechercher();
       $recherche = $rechercher->CreateRecherche(_request('recherche'));
       if (!$recherche) return;
       $regexp = $rechercher->CreateRegexp($recherche);
       if ($rechercher->TableAllowed($id_table)) {
         $fields = array();
          foreach ($crit->param as $param_array) {
            $par = $param_array[0]; 
	        $fields[] = $par->texte;
          }
         $where = $rechercher->CreateBoucleWhereElement($id_table, $fields, $regexp);
         //var_dump($where); exit;
         if ($where)  
            $boucle->where[] = $where;
       }
    }
  ?>